﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<TBlog.Models.Post>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"></asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Post</h2>

    <table>
        <tr>
            <th></th>
            <th>
                post_title
            </th>
            <th>
                post_author
            </th>            
            <th>
                post_date
            </th>
            <th>
                post_category_id
            </th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            <td>
                <%: Html.ActionLink("Edit", "EditPost", new { id=item.post_id }) %> |
                <%: Html.ActionLink("Details", "DetailsPost", new { id=item.post_id })%> |
                <%: Html.ActionLink("Delete", "DeletePost", new { id=item.post_id })%>
            </td>
            <td>
                <%: item.post_title %>
            </td>
            <td>
                <%: item.post_author %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.post_date) %>
            </td>
            <td>
                <%: item.post_category_id %>
            </td>
        </tr>
    
    <% } %>

    </table>

    <p>
        <%: Html.ActionLink("Create New Post", "CreatePost") %>
    </p>

</asp:Content>

